#ifndef __UM_QUEUE_H__
#define __UM_QUEUE_H__

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <assert.h>
#include "um_basic_types.h"

#define USEMUTEXT 1

#if USEMUTEXT
#include "umapi_os_list.h"
#include "umapi_os_mutex.h"
#include "umapi_libc.h"
typedef struct Node{      
	UM_VOID* data;
	struct umapi_list_head head;
}S_QUEUE_NODE;
typedef struct Queue
{    
	UM_HANDLE mutexHandle;
	struct umapi_list_head head;
}S_QUEUE;	
#else
typedef struct Node{    
	struct Node *next;    
	UM_VOID* data;
	UM_VOID* pri;
}S_QUEUE_NODE;
typedef struct Queue
{    
	S_QUEUE_NODE* front;    
	S_QUEUE_NODE* rear;
}S_QUEUE;
#endif
extern UM_S32 QuePop(S_QUEUE *que, UM_VOID **d);
extern UM_VOID QuePush(S_QUEUE *que, UM_VOID *d);
extern UM_S32 QueEmpty(S_QUEUE *que);
extern UM_VOID  QueInit(S_QUEUE *que);
extern void Que_for(S_QUEUE *que, void (*doItem)(void *value,void *param ),void *param);
#endif